import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore(
  'token',
  () => {
    const token = ref('')
    const setToken = (t: string) => {
      token.value = t
    }

    return { token, setToken }
  },
  {
    // 使用paths 制定持久化
    unistorage: {
      key: 'cp-user',
      paths: ['token'],
    },
  }
)
